package fem2.gui;

import fem2.gui.pm.HofemPipelineFactory;
import inf.vtk.pm.ActorManager;
import inf.vtk.pm.CurvesPipeline;
import inf.vtk.pm.PipelineCollection;
import inf.vtk.pm.SolidElementsPipeline;
import inf.vtk.pm.uiswing.ActorCheckBox;
import inf.vtk.pm.uiswing.LeftBox;

import java.awt.BorderLayout;

public class VisiblePanel extends LeftBox {

	private static final long serialVersionUID = 1L;

	private PipelineCollection pipelineCollection_;

	public VisiblePanel(PipelineCollection pc) {
		super("Visible");
		pipelineCollection_ = pc;
		initialize();
	}

	private CurvesPipeline getCurvesPipeline() {
		CurvesPipeline cp = (CurvesPipeline) pipelineCollection_
				.getPart(HofemPipelineFactory.PL_EDGES);

		assert cp != null;
		return cp;
	}

	private SolidElementsPipeline getSolidElementsPipeline() {
		return (SolidElementsPipeline) pipelineCollection_.getPart(HofemPipelineFactory.PL_FACES);
	}

	private void initialize() {
		initLayout();
	}

	private void initLayout() {
		// ActorManager llam =
		// getCurvesPipeline().getActorManager(CurvesPipeline.ACTOR_CURVES);

		ActorManager slam = getSolidElementsPipeline().getActorManager(
				SolidElementsPipeline.ACTOR_ELEMENTS_RC);

		// add(new ActorCheckBox("Edges", getCurvesPipeline(), llam),
		// BorderLayout.EAST);
		add(new ActorCheckBox("Surface", getSolidElementsPipeline(), slam), BorderLayout.CENTER);
	}
}
